#include "Time.h"

#include <algorithm>

clock_t Time::current_clock;
clock_t Time::last_clock;

void Time::init()
{
	current_clock = clock();
	last_clock = current_clock;
}

clock_t Time::tick()
{
	current_clock = clock();
	clock_t tick = current_clock - last_clock;
	last_clock = current_clock;
	return tick;
}

void Time::wait(clock_t milliseconds)
{
  clock_t endwait = clock () + milliseconds * (CLOCKS_PER_SEC/1000) ;
  while (clock() < endwait) {}
}


